import {
    HomeFilled,
    User,
    Setting,
    Goods,
    ShoppingCart,
    List,
    Document,
    PieChart,
    Bell,
    Lock,
    Monitor,
    Timer,
    Connection,
    DataAnalysis,
    Files,
    Tools
} from '@element-plus/icons-vue'
import type {Component} from 'vue'

// 菜单图标组件名称映射
export const iconMap: Record<string, Component> = {
    'home': HomeFilled,
    'user': User,
    'setting': Setting,
    'goods': Goods,
    'cart': ShoppingCart,
    'list': List,
    'document': Document,
    'chart': PieChart,
    'notification': Bell,
    'lock': Lock,
    'monitor': Monitor,
    'timer': Timer,
    'connection': Connection,
    'data': DataAnalysis,
    'files': Files,
    'tools': Tools
}

// 菜单项类型定义
export interface MenuItem {
    id: string
    name: string
    icon?: string
    path?: string
    children?: MenuItem[]
    permission?: string
    isExternal?: boolean
    externalLink?: string
    openMode?: 'blank' | 'iframe'
    badge?: {
        content: string | number
        type?: 'primary' | 'success' | 'warning' | 'danger' | 'info'
        isDot?: boolean
    }
    createdTime?: string
    createdBy?: string
    updatedTime?: string
    updatedBy?: string
}

// 菜单配置数据
export const menuItems: MenuItem[] = [
    {
        id: 'dashboard',
        name: '控制台',
        icon: 'home',
        path: '/admin/index'
    },
    {
        id: 'template',
        name: '组件示例',
        icon: 'list',
        children: [
            {
                id: 'table-demo',
                name: '表格示例',
                icon: 'list',
                path: '/admin/template/table'
            },
            {
                id: 'icon-demo',
                name: '图标示例',
                icon: 'document',
                path: '/admin/template/icon'
            }
        ]
    },
    {
        id: 'system',
        name: '系统管理',
        icon: 'setting',
        children: [
            {
                id: 'user',
                name: '用户管理',
                icon: 'user',
                path: '/admin/system/user'
            },
            {
                id: 'dept',
                name: '部门管理',
                icon: 'list',
                path: '/admin/system/dept'
            },
            {
                id: 'post',
                name: '岗位管理',
                icon: 'document',
                path: '/admin/system/post'
            },
            {
                id: 'role',
                name: '角色管理',
                icon: 'lock',
                path: '/admin/system/role'
            },
            {
                id: 'menu',
                name: '菜单管理',
                icon: 'list',
                path: '/admin/system/menu'
            },
            {
                id: 'dict',
                name: '字典管理',
                icon: 'document',
                path: '/admin/system/dict'
            },
            {
                id: 'config',
                name: '系统配置',
                icon: 'setting',
                path: '/admin/system/config'
            },
            {
                id: 'profile',
                name: '个人中心',
                icon: 'user',
                path: '/admin/system/profile'
            }
        ]
    },
    {
        id: 'monitor',
        name: '系统监控',
        icon: 'monitor',
        children: [
            {
                id: 'job',
                name: '定时任务',
                icon: 'timer',
                path: '/admin/monitor/job'
            },
            {
                id: 'cache',
                name: '数据缓存',
                icon: 'data',
                path: '/admin/monitor/cache'
            },
            {
                id: 'online',
                name: '在线用户',
                icon: 'user',
                path: '/admin/monitor/online'
            },
            {
                id: 'sql',
                name: 'SQL监控',
                icon: 'data',
                path: '/admin/monitor/sql'
            }
        ]
    },
    {
        id: 'log',
        name: '日志管理',
        icon: 'document',
        children: [
            {
                id: 'operlog',
                name: '操作日志',
                icon: 'document',
                path: '/admin/log/operlog'
            },
            {
                id: 'loginlog',
                name: '登录日志',
                icon: 'list',
                path: '/admin/log/loginlog'
            }
        ]
    },
    {
        id: 'tool',
        name: '系统工具',
        icon: 'tools',
        children: [
            {
                id: 'file',
                name: '文件管理',
                icon: 'files',
                path: '/admin/tool/file'
            },
            {
                id: 'gen',
                name: '代码生成',
                icon: 'document',
                path: '/admin/tool/gen'
            }
        ]
    },
    {
        id: 'external',
        name: '外部链接',
        icon: 'list',
        children: [
            {
                id: 'github',
                name: 'GitHub',
                isExternal: true,
                externalLink: 'https://github.com',
                openMode: 'blank',
                path:'/admin/external/github'
            },
            {
                id: 'element-plus',
                name: 'Element Plus',
                isExternal: true,
                externalLink: 'https://element-plus.org',
                openMode: 'iframe',
                path:'/admin/external/element-plus'
            }
        ]
    }
] 